<?php
define('IN_MEDIA',true);

$asx = '<?xml version="1.0" encoding="utf-8"?>'.
	'<playlist version="1" xmlns="http://xspf.org/ns/0/">'.
	'<trackList>';	
	
	$q = $mysql->query("SELECT *  FROM ".$tb_prefix."album WHERE album_trailer <> '' ORDER BY RAND() DESC LIMIT 10");
    while ($r = $mysql->fetch_array($q)) {
    if ($r['album_is_local'])
    $url = $mediaFolder[$r['album_is_local']].'/'.$r['album_trailer'];
    else
    $url = $r['album_trailer'];
    $url = m_unhtmlchars($url);
    $asx .= '<track>'.
		'<Title>'.m_unhtmlchars($r['album_name']).'</Title>'.
		'<creator>'.m_unhtmlchars($webTitle).'</creator>'.
		'<location>'.$url.'</location>'.
		//'<image>'.m_get_img('Album',$r['album_img']).'</image>'.
	'</track>';
	}
$asx .= '</trackList>'.
	'</playlist>';
$filename='trailer.xml';
$xmlfile = $filename;
$file = fopen($xmlfile,"w");
fwrite($file,$asx);
fclose($file);
?>